// 处理用户相关的请求的模块

import request from '@/utils/request.js'

export const postLogin = (mobile,
  code) => {
  // const a = await axios()
  return request({
    url: '/mp/v1_0/authorizations',
    method: 'POST',
    data: {
      mobile,
      code
    }
  })
}

/**
 * header设置
 * Authorization
 * 'Bearer ' + token
 *  */

export const getUserInfo = () => {
  return request({
    url: '/mp/v1_0/user/profile',
    method: 'GET'
  })
}

//   export default {
//       fn:fn,
//       fn2:fn2
//   }
// export导出的语法
// export const fn1 = ()=>{}
// export const fn2 = ()=>{}
// export const a = 10

// import {fn1, a} from 'xxoo.js'

export const getFansList = (params) => {
  return request({
    method: 'get',
    url: '/mp/v1_0/followers',
    params
  })
}

export const getFollowList = () => {
  return request.get('/mp/v1_0/statistics/followers')
}

export const updateUserInfo = (data) => {
  return request({
    method: 'PATCH',
    url: '/mp/v1_0/user/profile',
    data
  })
}

export const uploadUserImage = (fd) => {
  return request({
    method: 'patch',
    url: '/mp/v1_0/user/photo',
    data: fd
  })
}
